home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue28 / subclass / app2main.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-09-09  |  1.6 KB  |  76 lines

  1. unit app2main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ExtCtrls, example, example2, example3;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     Button2: TButton;
  13.     Button3: TButton;
  14.     Panel1: TPanel;
  15.     Button4: TButton;
  16.     Button5: TButton;
  17.     procedure Button1Click(Sender: TObject);
  18.     procedure Button2Click(Sender: TObject);
  19.     procedure Button3Click(Sender: TObject);
  20.     procedure Button4Click(Sender: TObject);
  21.     procedure Button5Click(Sender: TObject);
  22.   private
  23.     fexample : texample;
  24.     fexample2 : texample2;
  25.     fexample3 : texample3;
  26.   public
  27.     { Public declarations }
  28.   end;
  29.  
  30. var
  31.   Form1: TForm1;
  32.  
  33. implementation
  34.  
  35. {$R *.DFM}
  36.  
  37. procedure TForm1.Button1Click(Sender: TObject);
  38. begin
  39.   fexample := texample.create(self);
  40.   fexample.parent := self;
  41.   fexample.top := button3.top + button3.height + 10;
  42.   fexample.Left := button3.left;
  43. end;
  44.  
  45. procedure TForm1.Button2Click(Sender: TObject);
  46. begin
  47.   fexample.turnOnSubClassing;
  48. end;
  49.  
  50. procedure TForm1.Button3Click(Sender: TObject);
  51. begin
  52.   fexample.TurnOffSubClassing;
  53. end;
  54.  
  55. procedure TForm1.Button4Click(Sender: TObject);
  56. begin
  57.   with texample.create(Panel1) do begin
  58.     parent := Panel1;
  59.     top := panel1.height div 2 - height div 2;
  60.     Left := panel1.width div 2 - width div 2;
  61.     turnOnSubclassing;
  62.     end;
  63. end;
  64.  
  65. procedure TForm1.Button5Click(Sender: TObject);
  66. begin
  67.   fexample2 := texample2.create(panel1);
  68.   with fexample2 do begin
  69.     parent := Panel1;
  70.     top := 5;
  71.     Left := 5;
  72.     end;
  73. end;
  74.  
  75. end.
  76.